import sqlite3
import streamlit as st
conn = sqlite3.connect("test.db")
cursor = conn.cursor()
st.title("登录页面")
name = st.text_input("",placeholder="用户名")
passwd = st.text_input("",placeholder="密码",type="password")
if st.button("登录"):
    #从数据库读取该用户和密码,判断是否能读取
  cursor.execute(
      "select * from users where name=? and passwd=?" ,
      (name,passwd)
  )
  ret = cursor.fetchone()
  if ret:
    st.success("登录成功")
  else:
    st.error("用户名不正确")
cursor.close()
conn.close()
